#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define maxn 1001
#define inf 0x7f7f7f7f
#define Rep(i,a,b) for(int i=(a);i<=(b);++i)
#define Per(i,a,b) for(int i=(a);i>=(b);--i)
int n,l,r;
int main() {
	freopen("candy.in","r",stdin);
	freopen("candy.out","w",stdout);
	scanf("%d%d%d",&n,&l,&r);
	if(l/n==r/n) printf("%d",r%n);
	else printf("%d",n-1);
	return 0;
}

